#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll DJBHash(char* a) {
    ll length=strlen(a);
    ll hash=5381;
    for (int i=0; i<length; i++) {
        hash = ((hash<<5) + hash) + a[i];
    }
    return ((ull)hash<<1)>>1;
}
ll BKDRHash(char *a) {
    ll length=strlen(a);
    ll seed=31;
    ll hash=0;
    for (int i=0; i<length; i++) {
        hash = (hash*seed) + a[i];
    }
    return ((ull)hash<<1)>>1;
}
int main() {
    char str[1000];
    while (~scanf("%s", str)) {
        printf("DJBHash: %lld\n", DJBHash(str));
        printf("BKDRHash: %lld\n", BKDRHash(str));
    }
    return 0;
}
